#ifndef CHAIRMANSHIPHISTORYMANAGER_HPP
#define CHAIRMANSHIPHISTORYMANAGER_HPP

#include <gtest/gtest.h>
#include "ChairmanshipHistoryManager.h"

TEST(ChairmanshipHistorySerialization, ShoudWorkAsExpected)
{
  ChairmanshipHistory one("1", "1", "1", static_cast<time_t>(10002), static_cast<time_t>(10002));
  ChairmanshipHistory two("2", "2", "2", static_cast<time_t>(10003), static_cast<time_t>(10003));
  ChairmanshipHistoryManager manager;
  manager.insert(one);
  manager.insert(two);
  ASSERT_EQ(2, manager.size());

  manager.serialize("./chairmanship_history.csv");
  manager.deserialize("./chairmanship_history.csv");

  ASSERT_EQ(2, manager.size());
  const ChairmanshipHistory *gotOne = manager.historyById(one.id());
  const ChairmanshipHistory *gotTwo = manager.historyById(two.id());

  ASSERT_TRUE(gotOne != 0);
  ASSERT_TRUE(gotTwo != 0);
  ASSERT_EQ(one, *gotOne);
  ASSERT_EQ(two, *gotTwo);
}

#endif // CHAIRMANSHIPHISTORYMANAGER_HPP